#include "UserInterface.h"

UserInterface::UserInterface() {
    namedWindow("Face Recognition", WINDOW_AUTOSIZE);
}

void UserInterface::showFrame(const Mat& frame, const string& windowName) {
    imshow(windowName, frame);
}

void UserInterface::drawFaceRect(Mat& frame, const Rect& face, const string& label) {
    rectangle(frame, face, Scalar(0, 255, 0), 2);
    if (!label.empty()) {
        putText(frame, label, Point(face.x, face.y - 10),
            FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 2);
    }
}

void UserInterface::drawInfo(Mat& frame, const string& info) {
    putText(frame, info, Point(10, 30),
        FONT_HERSHEY_SIMPLEX, 0.7, Scalar(0, 0, 255), 2);
}

bool UserInterface::handleKeyboard() {
    char key = waitKey(1);
    return key != ESC_KEY;
}